package secondBrush.string;

import java.util.Arrays;

public class E01Leetcode344 {
    public void reverseString(char[] s) {
        int length = s.length;
        int left = 0;
        int right = length - 1;
        while (left < right) {
            char temp = s[left];
            s[left] = s[right];
            s[right] = temp;
            left++;
            right--;
        }

    }



    public static void main(String[] args) {
        char[] s = new char[]{'h', 'e', 'l', 'l', 'o'};
        System.out.println("反转前s: " + Arrays.toString(s));
        new E01Leetcode344().reverseString(s);
        System.out.println("翻转后： " + Arrays.toString(s));

    }
}
